<?php
	class xeploaicndb
	{
		public function Add($MaHocSinh,  $NamHoc, $DiemTBCN, $MaHanhKiem, $XepLoaiCN)
		{
			$sql = "INSERT INTO `tbl_xeploaicn`(`MaHocSinh`, `NamHoc`, `DiemTBCN`, `MaHanhKiem`, `XepLoaiCN`) 
			VALUES ('$MaHocSinh',  '$NamHoc', $DiemTBCN, $MaHanhKiem, '$XepLoaiCN')";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		
		public function Update($MaHocSinh,  $NamHoc, $DiemTBCN, $MaHanhKiem, $XepLoaiCN)
		{
			$sql = " UPDATE  `tbl_xeploaicn` 
			 SET DiemTBCN = $DiemTBCN,
				 MaHanhKiem = $MaHanhKiem,
				 XepLoaiHK = '$XepLoaiCN'			
			WHERE MaHocSinh = '$MaHocSinh' AND NamHoc = '$NamHoc'  "; 
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
	
	
		public function GetList($MaHocSinh,  $NamHoc)
		{
			$sql = " SELECT * FROM  `tbl_xeploaicn`,`tbl_hocsinh`,`tbl_hanhkiem`, `tbl_namhoc` WHERE  tbl_xeploaicn.MaHocSinh = tbl_hocsinh.MaHocSinh AND tbl_xeploaicn.MaHanhKiem = tbl_hanhkiem.MaHanhKiem AND tbl_xeploaicn.NamHoc = tbl_namhoc.NamHoc  ";
			if($MaHocSinh!="")
				$sql .= " AND tbl_xeploaicn.MaHocSinh = '$MaHocSinh' ";			
			if($NamHoc!="")
				$sql .= " AND tbl_xeploaicn.NamHoc = '$NamHoc' ";			
			$data = new dataservice();
			return $data->ExecuteQuery($sql);
		}
		
		
	}
?>